home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / term43-source.lha / Extras / Source / gtlayout-Source.lha / LT_SetAttributes.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-16  |  19.6 KB  |  948 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1994 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. */
  6.  
  7. #include "gtlayout_global.h"
  8.  
  9. VOID __stdargs
  10. LT_SetAttributes(LayoutHandle *handle,LONG id,...)
  11. {
  12.     va_list VarArgs;
  13.  
  14.     va_start(VarArgs,id);
  15.     LT_SetAttributesA(handle,id,(struct TagItem *)VarArgs);
  16.     va_end(VarArgs);
  17. }
  18.  
  19. VOID LIBENT
  20. LT_SetAttributesA(REG(a0) LayoutHandle *handle,REG(d0) LONG id,REG(a1) struct TagItem *TagList)
  21. {
  22.     if(handle && TagList)
  23.     {
  24.         struct Gadget    *Gadget;
  25.         struct TagItem    *ThisTag;
  26.         ObjectNode    *Node;
  27.  
  28.         if(ThisTag = FindTagItem(LH_AutoActivate,TagList))
  29.             handle -> AutoActivate = ThisTag -> ti_Data;
  30.  
  31.         if(ThisTag = FindTagItem(LH_UserData,TagList))
  32.             handle -> UserData = (APTR)ThisTag -> ti_Data;
  33.  
  34.         if(ThisTag = FindTagItem(LH_ExitFlush,TagList))
  35.             handle -> ExitFlush = ThisTag -> ti_Data;
  36.  
  37.         if(ThisTag = FindTagItem(LH_LocaleHook,TagList))
  38.             handle -> LocaleHook = (struct Hook *)ThisTag -> ti_Data;
  39.  
  40.         if(ThisTag = FindTagItem(LAPR_Gadget,TagList))
  41.             Gadget = (struct Gadget *)ThisTag -> ti_Data;
  42.         else
  43.             Gadget = NULL;
  44.  
  45.         if(ThisTag = FindTagItem(LAPR_Object,TagList))
  46.             Node = (ObjectNode *)ThisTag -> ti_Data;
  47.         else
  48.             Node = NULL;
  49.  
  50.         if(Node)
  51.             Gadget = Node -> Host;
  52.         else
  53.         {
  54.             if(Gadget)
  55.             {
  56.                 if(Node = (ObjectNode *)Gadget -> UserData)
  57.                 {
  58.                     if(Node -> Host != Gadget || Node -> PointBack != Node)
  59.                         Node = NULL;
  60.                 }
  61.             }
  62.         }
  63.  
  64.         if(!Gadget)
  65.         {
  66.             if(Gadget = LTP_FindGadget(handle,id))
  67.             {
  68.                 if(Node = (ObjectNode *)Gadget -> UserData)
  69.                 {
  70.                     if(Node -> Host != Gadget || Node -> PointBack != Node)
  71.                         Node = NULL;
  72.                 }
  73.             }
  74.             else
  75.                 Node = LTP_FindNode(handle -> TopGroup,id);
  76.         }
  77.  
  78.         if(Node)
  79.         {
  80.             STATIC Tag Filter[] = { GA_Disabled,TAG_DONE };
  81.  
  82.             struct TagItem    *NewTags = NULL;
  83.             ULONG         Exclude = NULL;
  84.  
  85.             switch(Node -> Type)
  86.             {
  87.                 case STRING_KIND:
  88.  
  89.                     if(ThisTag = FindTagItem(GTST_String,TagList))
  90.                     {
  91.                         Exclude = GTST_String;
  92.  
  93.                         GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  94.                             GTST_String,ThisTag -> ti_Data,
  95.                         TAG_DONE);
  96.  
  97.                         LTP_PutStorage(Node);
  98.                     }
  99.  
  100.                     if(ThisTag = FindTagItem(LAST_CursorPosition,TagList))
  101.                     {
  102.                         struct StringInfo    *StringInfo = Gadget -> SpecialInfo;
  103.                         LONG             Position,Len;
  104.  
  105.                         RemoveGList(handle -> Window,handle -> List,(UWORD)-1);
  106.  
  107.                         Position = (LONG)ThisTag -> ti_Data;
  108.  
  109.                         Len = strlen(StringInfo -> Buffer);
  110.  
  111.                         if(Position == -1)
  112.                             Position = Len;
  113.                         else
  114.                         {
  115.                             if(Position < 0)
  116.                                 Position = 0;
  117.                             else
  118.                             {
  119.                                 if(Position > Len)
  120.                                     Position = Len;
  121.                             }
  122.                         }
  123.  
  124.                         StringInfo -> BufferPos = Position;
  125.  
  126.                         AddGList(handle -> Window,handle -> List,(UWORD)-1,(UWORD)-1,NULL);
  127.                         RefreshGList(Gadget,handle -> Window,NULL,1);
  128.                     }
  129.  
  130.                     break;
  131.  
  132. #ifdef DO_LEVEL_KIND
  133.                 case LEVEL_KIND:
  134.                 {
  135.                     BOOLEAN         ChangeIt    = FALSE;
  136.                     LevelExtra    *Special    = &Node -> Special . Level;
  137.  
  138.                     if(ThisTag = FindTagItem(LAVL_Min,TagList))
  139.                     {
  140.                         Special -> Min = (LONG)ThisTag -> ti_Data;
  141.  
  142.                         ChangeIt = TRUE;
  143.                     }
  144.  
  145.                     if(ThisTag = FindTagItem(LAVL_Max,TagList))
  146.                     {
  147.                         Special -> Max = (LONG)ThisTag -> ti_Data;
  148.  
  149.                         ChangeIt = TRUE;
  150.                     }
  151.  
  152.                     if(ThisTag = FindTagItem(LAVL_Level,TagList))
  153.                     {
  154.                         Special -> Level = (LONG)ThisTag -> ti_Data;
  155.  
  156.                         LTP_PutStorage(Node);
  157.  
  158.                         ChangeIt = TRUE;
  159.                     }
  160.  
  161.                     if(Special -> Max < Special -> Min)
  162.                         Special -> Max = Special -> Min;
  163.  
  164.                     if(Special -> Level > Special -> Max)
  165.                         Special -> Level = Special -> Max;
  166.  
  167.                     if(Special -> Level < Special -> Min)
  168.                         Special -> Level = Special -> Min;
  169.  
  170.                     if(ChangeIt && Gadget && handle -> Window)
  171.                     {
  172.                         LONG Plus = Special -> Plus;
  173.  
  174.                         SetAttrs(Special -> LevelImage,
  175.                             LVIA_Current,    Special -> Level    - Plus,
  176.                             LVIA_Max,    Special -> Max        - Plus,
  177.                         TAG_DONE);
  178.  
  179.                         DrawImageState(&handle -> RPort,Special -> LevelImage,Gadget -> LeftEdge,Gadget -> TopEdge,IDS_NORMAL,handle -> DrawInfo);
  180.  
  181.                         LTP_LevelGadgetDrawLabel(Gadget,FALSE);
  182.                     }
  183.  
  184.                     break;
  185.                 }
  186. #endif    /* DO_LEVEL_KIND */
  187.                 case CHECKBOX_KIND:
  188.  
  189.                     if(ThisTag = FindTagItem(GTCB_Checked,TagList))
  190.                     {
  191.                         if((Node -> Current && ThisTag -> ti_Data) || (!Node -> Current && !ThisTag -> ti_Data))
  192.                             Exclude = GTCB_Checked;
  193.                         else
  194.                         {
  195.                             Node -> Current = ThisTag -> ti_Data;
  196.  
  197.                             LTP_PutStorage(Node);
  198.                         }
  199.                     }
  200.  
  201.                     break;
  202.  
  203. #ifdef DO_TAPEDECK_KIND
  204.                 case TAPEDECK_KIND:
  205.  
  206.                     if(ThisTag = FindTagItem(LATD_Pressed,TagList))
  207.                     {
  208.                         if(Node -> Current != ThisTag -> ti_Data && Node -> Special . TapeDeck . Toggle)
  209.                         {
  210.                             Node -> Current = ThisTag -> ti_Data;
  211.  
  212.                             if(Gadget)
  213.                             {
  214.                                 RemoveGList(handle -> Window,handle -> List,(UWORD)-1);
  215.  
  216.                                 if(Node -> Current)
  217.                                     Gadget -> Flags |= GFLG_SELECTED;
  218.                                 else
  219.                                     Gadget -> Flags &= ~GFLG_SELECTED;
  220.  
  221.                                 AddGList(handle -> Window,handle -> List,(UWORD)-1,(UWORD)-1,NULL);
  222.                                 RefreshGList(Gadget,handle -> Window,NULL,1);
  223.                             }
  224.                         }
  225.                     }
  226.  
  227.                     break;
  228. #endif    /* DO_TAPEDECK_KIND */
  229.  
  230. #ifdef DO_GAUGE_KIND
  231.                 case GAUGE_KIND:
  232.                 {
  233.                     LONG    Percent     = (LONG)Node -> Current;
  234.                     BOOLEAN NeedRefresh    = FALSE;
  235.  
  236.                     if(ThisTag = FindTagItem(LAGA_Percent,TagList))
  237.                     {
  238.                         Percent = (LONG)ThisTag -> ti_Data;
  239.  
  240.                         if(Percent < 0)
  241.                             Percent = 0;
  242.                         else
  243.                         {
  244.                             if(Percent > 100)
  245.                                 Percent = 100;
  246.                         }
  247.  
  248.                         if(Percent != (LONG)Node -> Current)
  249.                             NeedRefresh = TRUE;
  250.                     }
  251.  
  252.                     if(ThisTag = FindTagItem(LAGA_InfoText,TagList))
  253.                     {
  254.                         STRPTR SomeText = (STRPTR)ThisTag -> ti_Data;
  255.  
  256.                         if(Node -> Special . Gauge . InfoLength)
  257.                         {
  258.                             LONG Len = strlen(SomeText);
  259.  
  260.                             if(Len > Node -> Special . Gauge . InfoLength)
  261.                                 Len = Node -> Special . Gauge . InfoLength;
  262.  
  263.                             CopyMem(SomeText,Node -> Special . Gauge . InfoText,Len);
  264.  
  265.                             Node -> Special . Gauge . InfoText[Len] = 0;
  266.  
  267.                             NeedRefresh = TRUE;
  268.                         }
  269.                     }
  270.  
  271.                     if(NeedRefresh && Gadget)
  272.                         LTP_DrawGauge(handle,Node,Percent,FALSE);
  273.                 }
  274.  
  275.                 return;
  276. #endif
  277.                 case LISTVIEW_KIND:
  278.  
  279.                     if(ThisTag = FindTagItem(GTLV_Labels,TagList))
  280.                     {
  281.                         if(ThisTag -> ti_Data == (ULONG)~0)
  282.                             Node -> Min = Node -> Max = -1;
  283.                         else
  284.                         {
  285.                             struct List    *List;
  286.                             LONG         Count = 0;
  287.  
  288.                             if(List = (struct List *)ThisTag -> ti_Data)
  289.                             {
  290.                                 struct Node *Item;
  291.  
  292.                                 SCANLIST(List,Item)
  293.                                 {
  294.                                     Count++;
  295.                                 }
  296.                             }
  297.  
  298.                             Node -> Min = 0;
  299.  
  300.                             if(Count)
  301.                                 Node -> Max = Count - 1;
  302.                             else
  303.                                 Node -> Max = 0;
  304.                         }
  305.  
  306.                         Node -> Special . List . Labels = (struct List *)ThisTag -> ti_Data;
  307.                     }
  308.  
  309.                     if(ThisTag = FindTagItem(GTLV_Selected,TagList))
  310.                     {
  311.                         struct List *List;
  312.  
  313.                         Node -> Current = (LONG)ThisTag -> ti_Data;
  314.  
  315.                         if(ThisTag = FindTagItem(GTLV_Labels,TagList))
  316.                             List = (struct List *)ThisTag -> ti_Data;
  317.                         else
  318.                             List = NULL;
  319.  
  320.                         if(Gadget)
  321.                         {
  322.                             Exclude = GTLV_Selected;
  323.  
  324.                             if(Node -> Current < 0)
  325.                             {
  326.                                 GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  327.                                     GTLV_Selected,            Node -> Current,
  328.                                     List ? GTLV_Labels : TAG_IGNORE,List,
  329.                                 TAG_DONE);
  330.                             }
  331.                             else
  332.                             {
  333.                                 GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  334.                                     GTLV_Selected,            Node -> Current,
  335.                                     GTLV_Top,            Node -> Current,
  336.                                     GTLV_MakeVisible,        Node -> Current,
  337.  
  338.                                     List ? GTLV_Labels : TAG_IGNORE,List,
  339.                                 TAG_DONE);
  340.                             }
  341.                         }
  342.  
  343.                         LTP_PutStorage(Node);
  344.                     }
  345.  
  346.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  347.                     {
  348.                         if(!V39)
  349.                         {
  350.                             if(!(NewTags = CloneTagItems(TagList)))
  351.                                 return;
  352.                             else
  353.                                 FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  354.                         }
  355.                     }
  356.  
  357.                     break;
  358.  
  359.                 case MX_KIND:
  360.  
  361.                     if(ThisTag = FindTagItem(GTMX_Active,TagList))
  362.                     {
  363.                         if(Node -> Current == ThisTag -> ti_Data)
  364.                             Exclude = GTMX_Active;
  365.                         else
  366.                         {
  367.                             Node -> Current = ThisTag -> ti_Data;
  368.  
  369.                             LTP_PutStorage(Node);
  370.  
  371.                             if(Node -> Special . Radio . AutoPageID != -1)
  372.                             {
  373.                                 LT_SetAttributes(handle,Node -> Special . Radio . AutoPageID,
  374.                                     LAGR_ActivePage,Node -> Current,
  375.                                 TAG_DONE);
  376.                             }
  377.                         }
  378.                     }
  379.  
  380.                     if(!V39)
  381.                     {
  382.                         if(FindTagItem(GA_Disabled,TagList))
  383.                         {
  384.                             if(!(NewTags = CloneTagItems(TagList)))
  385.                                 return;
  386.                             else
  387.                                 FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  388.                         }
  389.                     }
  390.  
  391.                     break;
  392.  
  393.                 case CYCLE_KIND:
  394.  
  395.                     if(ThisTag = FindTagItem(GTCY_Active,TagList))
  396.                     {
  397.                         if(Node -> Current == ThisTag -> ti_Data)
  398.                             Exclude = GTCY_Active;
  399.                         else
  400.                         {
  401.                             Node -> Current = ThisTag -> ti_Data;
  402.  
  403.                             LTP_PutStorage(Node);
  404.  
  405.                             if(Node -> Special . Cycle . AutoPageID != -1)
  406.                             {
  407.                                 LT_SetAttributes(handle,Node -> Special . Cycle . AutoPageID,
  408.                                     LAGR_ActivePage,Node -> Current,
  409.                                 TAG_DONE);
  410.                             }
  411.                         }
  412.                     }
  413.  
  414.                     if(ThisTag = FindTagItem(GTCY_Labels,TagList))
  415.                     {
  416.                         STRPTR    *Strings;
  417.                         LONG     Count = 0;
  418.  
  419.                         if(Strings = (STRPTR *)ThisTag -> ti_Data)
  420.                         {
  421.                             while(Strings[Count])
  422.                                 Count++;
  423.                         }
  424.  
  425.                         if(Count)
  426.                             Node -> Max = Count - 1;
  427.                         else
  428.                             Node -> Max = 0;
  429.                     }
  430.  
  431.                     break;
  432.  
  433.                 case PALETTE_KIND:
  434.  
  435.                     if(ThisTag = FindTagItem(GTPA_Color,TagList))
  436.                     {
  437.                         if(Node -> Current == ThisTag -> ti_Data)
  438.                             Exclude = GTPA_Color;
  439.                         else
  440.                         {
  441.                             Node -> Current = ThisTag -> ti_Data;
  442.  
  443.                             LTP_PutStorage(Node);
  444.                         }
  445.                     }
  446.  
  447.                     break;
  448.  
  449.                 case INTEGER_KIND:
  450.  
  451.                     if(ThisTag = FindTagItem(GTIN_Number,TagList))
  452.                     {
  453.                         LONG num = ThisTag -> ti_Data;
  454.  
  455.                         if(num < Node -> Min)
  456.                             num = Node -> Min;
  457.                         else
  458.                         {
  459.                             if(num > Node -> Max)
  460.                                 num = Node -> Max;
  461.                         }
  462.  
  463.                         if(Gadget)
  464.                         {
  465. #ifdef DO_HEXHOOK
  466.                             if(!Node -> Special . Integer . EditHook)
  467.                             {
  468.                                 UBYTE             buffer[20];
  469.                                 struct StringInfo    *stringInfo;
  470.  
  471.                                 sprintf(buffer,"%ld",num);
  472.  
  473.                                 Exclude = GTIN_Number;
  474.  
  475.                                 GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  476.                                     GTST_String,buffer,
  477.                                 TAG_DONE);
  478.  
  479.                                 stringInfo = (struct StringInfo *)Gadget -> SpecialInfo;
  480.  
  481.                                 stringInfo -> LongInt = num;
  482.                             }
  483.                             else
  484.                             {
  485.                                 UBYTE             buffer[40];
  486.                                 struct StringInfo    *stringInfo;
  487.                                 STRPTR             Index;
  488.                                 LONG             Value,Number = num,
  489.                                              Scale,Sign;
  490.  
  491.                                 stringInfo = (struct StringInfo *)Gadget -> SpecialInfo;
  492.  
  493.                                 Index = stringInfo -> Buffer;
  494.  
  495.                                 while(*Index && *Index == ' ')
  496.                                     Index++;
  497.  
  498.                                 switch(Index[0])
  499.                                 {
  500.                                     case '$':
  501.  
  502.                                         sprintf(buffer,"$%lx",num);
  503.                                         break;
  504.  
  505.                                     case '&':
  506.  
  507.                                         if(Number < 0)
  508.                                         {
  509.                                             Sign = -1;
  510.                                             Number = -Number;
  511.                                         }
  512.                                         else
  513.                                             Sign = 1;
  514.  
  515.                                         for(Value = 0, Scale = 1 ; Number ; Number /= 8, Scale *= 10)
  516.                                             Value += (Number & 7) * Scale;
  517.  
  518.                                         sprintf(buffer,"&%ld",Sign * Value);
  519.                                         break;
  520.  
  521.                                     case '%':
  522.  
  523.                                         if(Number < 0)
  524.                                         {
  525.                                             Sign = -1;
  526.                                             Number = -Number;
  527.                                         }
  528.                                         else
  529.                                             Sign = 1;
  530.  
  531.                                         for(Value = 0, Scale = 1 ; Number ; Number /= 2, Scale *= 10)
  532.                                             Value += (Number & 1) * Scale;
  533.  
  534.                                         sprintf(buffer,"%%%ld",Sign * Value);
  535.                                         break;
  536.  
  537.                                     case '0':
  538.  
  539.                                         if(Index[1] == 'x')
  540.                                         {
  541.                                             sprintf(buffer,"0x%lx",num);
  542.                                             break;
  543.                                         }
  544.  
  545.                                         // Fall through to...
  546.  
  547.                                     default:
  548.  
  549.                                         sprintf(buffer,"%ld",num);
  550.                                         break;
  551.                                 }
  552.  
  553.                                 Exclude = GTIN_Number;
  554.  
  555.                                 GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  556.                                     GTST_String,buffer,
  557.                                 TAG_DONE);
  558.  
  559.                                 stringInfo -> LongInt = num;
  560.                             }
  561. #else
  562.                             GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  563.                                 GTIN_Number,num,
  564.                             TAG_DONE);
  565. #endif
  566.                         }
  567.  
  568.                         Node -> Special . Integer . Number = num;
  569.  
  570.                         LTP_PutStorage(Node);
  571.                     }
  572.  
  573.                     break;
  574.  
  575.                 case SLIDER_KIND:
  576.  
  577.                     if(ThisTag = FindTagItem(GTSL_Level,TagList))
  578.                     {
  579.                         if(Node -> Current == ThisTag -> ti_Data)
  580.                             Exclude = GTSL_Level;
  581.                         else
  582.                         {
  583.                             Node -> Current = ThisTag -> ti_Data;
  584.  
  585.                             LTP_PutStorage(Node);
  586.                         }
  587.                     }
  588.  
  589.                     if(ThisTag = FindTagItem(GTSL_Min,TagList))
  590.                     {
  591.                         Node -> Min = ThisTag -> ti_Data;
  592.  
  593.                         if(Node -> Current < Node -> Min)
  594.                         {
  595.                             Node -> Current = Node -> Min;
  596.  
  597.                             LTP_PutStorage(Node);
  598.                         }
  599.                     }
  600.  
  601.                     if(ThisTag = FindTagItem(GTSL_Max,TagList))
  602.                     {
  603.                         Node -> Max = ThisTag -> ti_Data;
  604.  
  605.                         if(Node -> Current > Node -> Max)
  606.                         {
  607.                             Node -> Current = Node -> Max;
  608.  
  609.                             LTP_PutStorage(Node);
  610.                         }
  611.                     }
  612.  
  613.                     break;
  614.  
  615.                 case SCROLLER_KIND:
  616.  
  617.                     if(ThisTag = FindTagItem(GTSC_Top,TagList))
  618.                     {
  619.                         if(Node -> Current == ThisTag -> ti_Data)
  620.                             Exclude = GTSC_Top;
  621.                         else
  622.                         {
  623.                             Node -> Current = ThisTag -> ti_Data;
  624.  
  625.                             LTP_PutStorage(Node);
  626.                         }
  627.                     }
  628.  
  629.                     if(ThisTag = FindTagItem(GTSC_Total,TagList))
  630.                     {
  631.                         Node -> Max = ThisTag -> ti_Data;
  632.  
  633.                         if(Node -> Current > Node -> Max)
  634.                         {
  635.                             Node -> Current = Node -> Max;
  636.  
  637.                             LTP_PutStorage(Node);
  638.                         }
  639.                     }
  640.  
  641.                     if(ThisTag = FindTagItem(GTSC_Visible,TagList))
  642.                         Node -> Special . Scroller . Visible = ThisTag -> ti_Data;
  643.  
  644.                     break;
  645.  
  646.                 case BOX_KIND:
  647.                 {
  648.                     BOOLEAN Visible = Node -> Special . Box . Parent -> Special . Group . Visible;
  649.  
  650.                     if(ThisTag = FindTagItem(LABX_Index,TagList))
  651.                     {
  652.                         LONG Index = ThisTag -> ti_Data;
  653.  
  654.                         if(Index >= 0 && Index < Node -> Lines)
  655.                         {
  656.                             if(ThisTag = FindTagItem(LABX_Text,TagList))
  657.                             {
  658.                                 if(Node -> Special . Box . ReserveSpace)
  659.                                 {
  660.                                     STRPTR    Text = (STRPTR)ThisTag -> ti_Data;
  661.                                     WORD    Len = strlen(Text);
  662.  
  663.                                     if(Len > Node -> Special . Box . MaxSize)
  664.                                         Len = Node -> Special . Box . MaxSize;
  665.  
  666.                                     CopyMem(Text,Node -> Special . Box . Lines[Index],Len);
  667.  
  668.                                     Node -> Special . Box . Lines[Index][Len] = 0;
  669.                                 }
  670.                                 else
  671.                                     Node -> Special . Box . Lines[Index] = (STRPTR)ThisTag -> ti_Data;
  672.  
  673.                                 if(Visible)
  674.                                     LTP_PrintBoxLine(handle,Node,Index);
  675.                             }
  676.                         }
  677.                     }
  678.  
  679.                     if(ThisTag = FindTagItem(LABX_Lines,TagList))
  680.                     {
  681.                         STRPTR    *Lines = (STRPTR *)ThisTag -> ti_Data;
  682.                         LONG     i;
  683.  
  684.                         if(Node -> Special . Box . ReserveSpace)
  685.                         {
  686.                             WORD Len;
  687.  
  688.                             for(i = 0 ; i < Node -> Lines ; i++)
  689.                             {
  690.                                 if(Lines[i])
  691.                                 {
  692.                                     Len = strlen(Lines[i]);
  693.  
  694.                                     if(Len > Node -> Special . Box . MaxSize)
  695.                                         Len = Node -> Special . Box . MaxSize;
  696.  
  697.                                     CopyMem(Lines[i],Node -> Special . Box . Lines[i],Len);
  698.  
  699.                                     Node -> Special . Box . Lines[i][Len] = 0;
  700.  
  701.                                     if(Visible)
  702.                                         LTP_PrintBoxLine(handle,Node,i);
  703.                                 }
  704.                                 else
  705.                                     break;
  706.                             }
  707.                         }
  708.                         else
  709.                         {
  710.                             for(i = 0 ; i < Node -> Lines ; i++)
  711.                             {
  712.                                 if(Lines[i])
  713.                                 {
  714.                                     Node -> Special . Box . Lines[i] = Lines[i];
  715.  
  716.                                     if(Visible)
  717.                                         LTP_PrintBoxLine(handle,Node,i);
  718.                                 }
  719.                                 else
  720.                                     break;
  721.                             }
  722.                         }
  723.                     }
  724.  
  725.                     break;
  726.                 }
  727.  
  728.                 case TEXT_KIND:
  729.  
  730.                     if(ThisTag = FindTagItem(GTTX_Text,TagList))
  731.                     {
  732.                         STRPTR text = (STRPTR)ThisTag -> ti_Data;
  733.  
  734.                         if(!text)
  735.                             text = "";
  736.  
  737.                         if(Node -> Special . Text . CopyText)
  738.                         {
  739.                             LONG len;
  740.  
  741.                             if(Node -> Special . Text . Text)
  742.                                 len = strlen(Node -> Special . Text . Text) + 1;
  743.                             else
  744.                                 len = 0;
  745.  
  746.                             if(len)
  747.                                 LTP_Free(handle,Node -> Special . Text . Text,len);
  748.  
  749.                             len = strlen(text);
  750.  
  751.                             if(Node -> Special . Text . Text = LTP_Alloc(handle,len + 1))
  752.                                 strcpy(Node -> Special . Text . Text,text);
  753.                         }
  754.                         else
  755.                             Node -> Special . Text . Text = text;
  756.                     }
  757.  
  758.                     break;
  759.  
  760.                 case GROUP_KIND:
  761.  
  762.                     if(Node -> Special . Group . Paging)
  763.                     {
  764.                         if(ThisTag = FindTagItem(LAGR_ActivePage,TagList))
  765.                         {
  766.                             ObjectNode *node;
  767.  
  768.                             node = Node;
  769.  
  770. //                            if(node = LTP_FindNode(handle -> TopGroup,id))
  771.                             {
  772.                                 if(node -> Type == GROUP_KIND)
  773.                                 {
  774.                                     if(node -> Special . Group . ActivePage != ThisTag -> ti_Data)
  775.                                     {
  776.                                         WORD    Left    = node -> Left,
  777.                                             Top    = node -> Top,
  778.                                             Width    = node -> Width,
  779.                                             Height    = node -> Height;
  780.  
  781.                                         if(node -> Label || node -> Special . Group . Frame)
  782.                                         {
  783.                                             Left    += 4 + handle -> GlyphWidth;
  784.                                             Width    -= 2 * (4 + handle -> GlyphWidth);
  785.  
  786.                                             if(node -> Label)
  787.                                             {
  788.                                                 Top    += handle -> RPort . TxHeight;
  789.                                                 Height    -= handle -> RPort . TxHeight + 3;
  790.                                             }
  791.                                             else
  792.                                             {
  793.                                                 Top    += 2;
  794.                                                 Height    -= 5;
  795.                                             }
  796.                                         }
  797.  
  798.                                         node -> Special . Group . ActivePage = ThisTag -> ti_Data;
  799.  
  800.                                         LT_LockWindow(handle -> Window);
  801.  
  802.                                         EraseRect(&handle -> RPort,Left,Top,Left + Width - 1,Top + Height - 1);
  803.  
  804.                                         LT_RebuildTagList(handle,FALSE,NULL);
  805.  
  806.                                         LT_UnlockWindow(handle -> Window);
  807.                                     }
  808.                                 }
  809.                             }
  810.                         }
  811.                     }
  812.  
  813.                     break;
  814.             }
  815.  
  816.             if(ThisTag = FindTagItem(LA_LabelText,TagList))
  817.                 Node -> Label = (STRPTR)ThisTag -> ti_Data;
  818.  
  819.             if(ThisTag = FindTagItem(LA_LabelID,TagList))
  820.             {
  821.                 if(handle -> LocaleHook)
  822.                     Node -> Label = (STRPTR)CallHookPkt(handle -> LocaleHook,handle,(APTR)ThisTag -> ti_Data);
  823.             }
  824.  
  825.             if(ThisTag = FindTagItem(GA_Disabled,TagList))
  826.             {
  827.                 if((Node -> Disabled && ThisTag -> ti_Data) || (!Node -> Disabled && !ThisTag -> ti_Data))
  828.                 {
  829.                     if(NewTags = CloneTagItems(TagList))
  830.                         FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  831.                 }
  832.                 else
  833.                 {
  834.                     Node -> Disabled = ThisTag -> ti_Data;
  835.  
  836.                     if(Gadget)
  837.                     {
  838.                         struct Gadget *gad;
  839.  
  840.                         switch(Node -> Type)
  841.                         {
  842. #ifdef DO_LEVEL_KIND
  843.                             case LEVEL_KIND:
  844.  
  845.                                 gad = Gadget;
  846.                                 break;
  847. #endif    /* DO_LEVEL_KIND */
  848.                             case TEXT_KIND:
  849.  
  850.                                 gad = Node -> Special . Text . Picker;
  851.                                 break;
  852.  
  853.                             case STRING_KIND:
  854.  
  855.                                 gad = Node -> Special . String . Picker;
  856.                                 break;
  857.  
  858.                             case INTEGER_KIND:
  859.  
  860.                                 if(gad = Node -> Special . Integer . LeftIncrementer)
  861.                                 {
  862.                                     RemoveGList(handle -> Window,handle -> List,(UWORD)-1);
  863.  
  864.                                     if(Node -> Disabled)
  865.                                         gad -> Flags |= GFLG_DISABLED;
  866.                                     else
  867.                                         gad -> Flags &= ~GFLG_DISABLED;
  868.  
  869.                                     AddGList(handle -> Window,handle -> List,(UWORD)-1,(UWORD)-1,NULL);
  870.                                     RefreshGList(gad,handle -> Window,NULL,1);
  871.                                 }
  872.  
  873.                                 gad = Node -> Special . Integer . RightIncrementer;
  874.                                 break;
  875.  
  876.                             case TAPEDECK_KIND:
  877.  
  878.                                 gad = Node -> Host;
  879.  
  880.                                 Gadget = NULL;
  881.  
  882.                                 break;
  883.  
  884.                             default:
  885.  
  886.                                 gad = NULL;
  887.                                 break;
  888.                         }
  889.  
  890.                         if(gad)
  891.                         {
  892.                             RemoveGList(handle -> Window,handle -> List,(UWORD)-1);
  893.  
  894.                             if(Node -> Disabled)
  895.                                 gad -> Flags |= GFLG_DISABLED;
  896.                             else
  897.                                 gad -> Flags &= ~GFLG_DISABLED;
  898.  
  899.                             AddGList(handle -> Window,handle -> List,(UWORD)-1,(UWORD)-1,NULL);
  900.                             RefreshGList(gad,handle -> Window,NULL,1);
  901.                         }
  902.                     }
  903.                 }
  904.             }
  905.  
  906.             if(Exclude)
  907.             {
  908.                 ULONG Filter[2];
  909.  
  910.                 Filter[0] = Exclude;
  911.                 Filter[1] = TAG_DONE;
  912.  
  913.                 if(!NewTags)
  914.                     NewTags = CloneTagItems(TagList);
  915.  
  916.                 if(NewTags)
  917.                     FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  918.             }
  919.  
  920.             if(Gadget)
  921.             {
  922.                 struct TagItem *tags = TagList;
  923.  
  924.                 if(NewTags)
  925.                     tags = NewTags;
  926.  
  927.                 if(!V39 && Node -> Disabled && Node -> Type == SLIDER_KIND)
  928.                 {
  929.                     GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  930.                         GA_Disabled,    FALSE,
  931.                     TAG_MORE,tags);
  932.  
  933.                     GT_SetGadgetAttrs(Gadget,handle -> Window,NULL,
  934.                         GA_Disabled,    TRUE,
  935.                     TAG_DONE);
  936.                 }
  937.                 else
  938.                     GT_SetGadgetAttrsA(Gadget,handle -> Window,NULL,tags);
  939.  
  940.                 if(Node -> Type == STRING_KIND || Node -> Type == FRACTION_KIND || Node -> Type == PASSWORD_KIND)
  941.                     LTP_PutStorage(Node);
  942.             }
  943.  
  944.             FreeTagItems(NewTags);
  945.         }
  946.     }
  947. }
  948.